home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / Bonus / Plasmatech / ptscp_eval.exe / %MAINDIR% / Interface / UPTShellUtils.int < prev    next >
Encoding:
Text File  |  2001-08-31  |  20.7 KB  |  474 lines

  1. unit UPTShellUtils; // Copyright ⌐ 1996-2001 Plasmatech Software Design. All rights reserved.
  2. {
  3.  Shell Control Pack
  4.  Version 1.6
  5.  
  6.  Implements low-level utilities useful for dealing with shell interfaces and structures.
  7.  Also includes utilities for creating and resolving shortcuts.
  8.  
  9.  History
  10.  ===================================================================================================
  11.  V1.6   2Jul01 Added ShellGetSpecialFolderIconIndex.
  12.  V1.5c 30Mar01 Fixed a memory leak in ShellFindCSIDLFromIdList.
  13.                Fixed DefWndProc call in DeviceChangeHandler to return function result.
  14.                Changed to central acquisition of shell's IMalloc interface to increase stability.
  15.  V1.5b 12Dec00 The hidden DeviceChangeHandler window now calls DefWndProc.
  16.  V1.5a 14May00 No changes.
  17.  V1.5   3Mar00 C++Builder 5 release.
  18.                Added 'noUi' option to TLinkData record.
  19.                Fixed WM_QUERYENDSESSION handling in hidden window used by DeviceChangeHandler.
  20.  V1.4a 15Dec99 Added FlushDriveInfoCache, LockFlushDriveInfoCache, and UnlockFlushDriveInfoCache
  21.                  to work around the Windows bug where drive information is cached too vigorously.
  22.                Added TPTDeviceChangeHandler class to manage broadcasting of WM_DEVICECHANGE
  23.                  messages to components that wouldn't normally receive the message, but want it
  24.                  (like TPTShellTree and TPTShellList).
  25.  V1.4  14Sep99 Added ShellFindCSIDLFromIdList.
  26.  V1.3h 29Mar99 Changed handling of cached IMalloc ptr g_IShm during some shutdown situations
  27.                  on NT4.
  28.                Fixed problem with EnsureTrailingCharDB function. It didn't actually work for
  29.                  double-byte character sets.
  30.  V1.3g  1Dec98 Added ShellIMalloc.
  31.  V1.3f 12Jul98 Delphi 4 release, no changes.
  32.  V1.3e 22Apr98 Added TPTPidlList object.
  33.  V1.3d 18Apr98 No changes.
  34.  V1.3c 16Mar98 C++Builder 3 support.
  35.  V1.3b  7Feb98 Added GetModuleVersion function and TPTModuleVersion type.
  36.                Added constants, types and variable COMCTL32_VER for determining the version of
  37.                  comctl32.dll at run-time.
  38.                Changed ShellGetSystemImageList to support shell link and network share overlay
  39.                  fix on WinNT/IE4.
  40.  V1.3a  7Jan98 Added ShellGetIconIndexFromExt.
  41.                Added ShellGetIconIndexFromPath.
  42.  V1.3  28Nov97 No changes.
  43.  V1.2b 12Oct97 No changes.
  44.  V1.2a  5Oct97 No changes.
  45.  V1.2   6Sep97 Added PTClsidFromFileType.
  46.                ShellMemAlloc, ShellMemRealloc and ShellMemFree now used a cached IMalloc interface.
  47.                ShellGetIconIndex method added.
  48.  V1.1a  6Jul97 Removed HWND params for C++Builder support.
  49.  V1.1  26Jun97 Fixed CompareAbsIdLists when Desktop folder used as either or both parameters.
  50.  V1.0c 31May97 No significant changes.
  51.  V1.0b 17May97 Delphi 3 support. Adjusted StrretFree to prevent exceptions under WinNT.
  52.  V1.0a  1May97 Added IsWinNT, IsWin95, HasWin95Shell functions.
  53.  V1.0  21Apr97 Released version 1.0
  54. }
  55.  
  56. {$I PTCompVer.inc}
  57.  
  58. {$RANGECHECKS OFF} {$OVERFLOWCHECKS OFF} {$WRITEABLECONST OFF}
  59. {$BOOLEVAL OFF}    {$EXTENDEDSYNTAX ON}  {$TYPEDADDRESS ON}
  60.  
  61. interface
  62. uses Windows, SysUtils, ShellApi, Dialogs, Ole2, Messages, Forms, Classes,
  63. {$IFDEF VCL30PLUS} ComObj, {$ENDIF} // For OleCheck
  64.        UPTShell95;
  65.  
  66. type TCSIDL = ( csidlDesktop,          // $0000
  67.                   csidl_None1,           // $0001
  68.                 csidlPrograms,         // $0002
  69.                 csidlControls,         // $0003
  70.                 csidlPrinters,         // $0004
  71.                 csidlPersonal,         // $0005
  72.                 csidlFavorites,        // $0006
  73.                 csidlStartup,          // $0007
  74.                 csidlRecent,           // $0008
  75.                 csidlSendTo,           // $0009
  76.                 csidlBitBucket,        // $000A
  77.                 csidlStartMenu,        // $000B
  78.                   csidl_None2,           // $000C
  79.                   csidl_None3,           // $000D
  80.                   csidl_None4,           // $000E
  81.                   csidl_None5,           // $000F
  82.                 csidlDesktopDirectory, // $0010
  83.                 csidlDrives,           // $0011
  84.                 csidlNetwork,          // $0012
  85.                 csidlNethood,          // $0013
  86.                 csidlFonts,            // $0014
  87.                 csidlTemplates,        // $0015
  88.                 csidlCommonStartMenu,  // $0016
  89.                 csidlCommonPrograms,   // $0017
  90.                 csidlCommonStartup,    // $0018
  91.                 csidlCommonDesktopDirectory, //$0019
  92.                 csidlAppData,          // $001a
  93.                 csidlPrintHood,        // $001b
  94.                   csidlNone );           // $001c
  95.  
  96. {-- General utilities. These are not necessarily shell related but are used by more than one Shell Control Pack unit. -- }
  97. function IsWin95: Boolean;
  98. function IsOSR2OrGreater: Boolean; // Returns TRUE if running Win95 OSR2 or higher.
  99. function IsWinNT: Boolean;
  100. function IsWin2000: Boolean;
  101. function HasWin95Shell: Boolean;
  102.  
  103. type
  104.   TPTModuleVersion = packed record
  105.     case Integer of
  106.       0: (w1, w2, w3, w4: Word);  // Higher number means more significant - w4=major, w3=minor etc.
  107.       1: (dw1, dw2: Integer);
  108. {$IFNDEF CBUILDER}
  109.       2: (asComp: Comp);          // Treat as a single 64-bit integer
  110. {$ENDIF}
  111.       3: (_1, _2, minor, major: Word);
  112.       4: (_3, version: Integer);
  113.   end;
  114.   PPTModuleVersion = ^TPTModuleVersion;
  115. // Unless you are specifically interested in the build version (w2 or w1) then you would normally
  116. // compare .version members.
  117.  
  118. function GetModuleVersion( const aModuleName: String;  var {out} aVersion: TPTModuleVersion ): Boolean;
  119.  
  120. {-- Comctl32.dll support --}
  121. const
  122.   COMCTL32_VER580 = (5 shl 16) or 80;         // IE5 version
  123.   COMCTL32_VER472 = (4 shl 16) or 72;         // IE4.01 version
  124.   COMCTL32_VER471 = (4 shl 16) or 71;         // IE4 version
  125.   COMCTL32_VER470 = (4 shl 16) or 70;         // IE3 version
  126.   COMCTL32_VER400 = (4 shl 16) or 00;         // Win95 first release version
  127.  
  128. var
  129.   COMCTL32_VER: TPTModuleVersion;
  130.  
  131.  
  132. {-- Utilities. There is virtually no performance penalty for using these ShellMem* routines compared
  133.     to calling SHGetMalloc yourself - and you don't have to manage the IMalloc interface. }
  134. function ShellMemAlloc(size: Cardinal): Pointer;
  135. procedure ShellMemFree(p: Pointer);
  136. function ShellMemRealloc(p: Pointer;  size: Cardinal): Pointer;
  137. function ShellIMalloc: IMalloc;
  138.  
  139. {-- Higher level conversion utils ----}
  140. function ShellGetFolderFromIdList( p: PItemIdList;  var ish: IShellFolder ): HResult;
  141. function ShellGetIdListFromPath( const path: String;  var p: PItemIdList ): HResult;
  142. function ShellGetPathFromIdList( p: PItemIdList ): String;
  143. function ShellGetDisplayPathName( aPathName: String ): String; // Returns the properly cased pathname
  144. function ShellGetSpecialFolderPath( ahwnd: TPTHWND;  csidl: TCSIDL ): String;
  145. function ShellGetSpecialFolderIdList( ahwnd: TPTHWND;  csidl: TCSIDL;  var idlist: PItemIdList ): HResult;
  146. function ShellGetIconIndex( absIdList: PItemIdList;  uFlags: DWORD ): Integer;
  147. function ShellGetIconIndexFromPath( const path: String;  uFlags: DWORD ): Integer;
  148. function ShellGetIconIndexFromExt( const ext: String;  uFlags: DWORD ): Integer;
  149. function ShellGetSpecialFolderIconIndex(csidl: TCSIDL;  uFlags: DWORD): Integer;
  150. function ShellFindCSIDLFromIdList( aIdList: PItemIdList ): TCSIDL;
  151.  
  152. type TPTFriendlyNameFlags = (ptfnNormal, ptfnInFolder, ptfnForParsing);
  153. function ShellGetFriendlyNameFromIdList( ishf: IShellFolder;  pidl: PItemIdList;  flags: TPTFriendlyNameFlags ): String;
  154. {
  155.  If ishf=nil, then pidl is an absolute item id list. A temporary IShellFolder for the desktop will
  156.  be created to get the name.
  157.  flags can be any SHGNO constant.
  158.  
  159.                   File system path     Display name             Notes
  160.                   -------------------- ------------------------ ----------------------------------------
  161.    ptfnNormal     C:\Windows\File.txt  file                     If not showing extensions
  162.                   \\Computer\Share     share on computer
  163.                   C:\                  My Drive (C)             Where C has the volume name My Drive
  164.  
  165.    ptfnInFolder   C:\Windows\File.txt  file
  166.                   \\Computer\Share     share
  167.                   C:\                  My Drive (C)
  168.  
  169.    ptfnForParsing C:\Windows\File.txt  C:\Windows\File.txt
  170.                   \\Computer\Share     \\Computer\Share
  171.                   C:\                  C:\
  172. }
  173.  
  174. type TPTShellIconSize = (ptsizSmall, ptsizLarge);
  175. function ShellGetSystemImageList( aSize: TPTShellIconSize ): THandle;
  176.  
  177. {-- String utilities -----------------}
  178. function StrretToString( pidl: PItemIdList;  const r: TStrRet ): String;
  179. procedure StrretFree( const r: TStrRet );
  180.  
  181. function EnsureTrailingCharDB( const aSource: String;  aTrailingChar: Char ): String;
  182.  
  183. {-- Low-level Pidl Utilities ---------}
  184. function CopyIdList( ishm: IMalloc;  pidl: PItemIdList ): PItemIdList;
  185. function ConcatIdLists( ishm: IMalloc;  aFirst, aSecond: PItemIdList ): PItemIdList;
  186. function IdListLen( pidl: PItemIdList ): Integer;
  187. function CompareAbsIdLists( pidl1, pidl2: PItemIdList ): Integer;
  188.   // Compare absolute (relative to desktop) pidls. Returns <0, 0 or >0. If result=MAXINT then function failed.
  189.  
  190. {The TPTIdListArray class treats an item id list as an array of items. You can easily process each
  191.  element of the pidl.
  192.  
  193.  property Item[ idx: Integer ]: PItemIdList;
  194.    The returned id is allocated from shell memory and returned. You don't have to free it. If you
  195.    want to keep it you should use CopyIdList() to make a copy. Each call to Item invalidates the previous
  196.    return value.
  197.  
  198.  Example:
  199.    procedure DoWork( pa: TPTIdListArray ):
  200.    var p1, p2: PItemIdList;
  201.    begin
  202.      p1 := pa.items[1];
  203.      p2 := pa.items[2]; // !!BUG p1 is now invalid.
  204.      // ... work ...
  205.    end;
  206.  
  207.   You should instead do this:
  208.    procedure DoWork( pa: TPTIdListArray ):
  209.    var p1, p2: PItemIdList;
  210.    begin
  211.      p1:=nil; p2:=nil;
  212.      try
  213.        p1 := CopyIdList(pa.items[1]);
  214.        p2 := CopyIdList(pa.items[2]);
  215.        // ... work ...
  216.      finally
  217.        if Assigned(p1) then ShellMemFree(p1);
  218.        if Assigned(p2) then ShellMemFree(p2);
  219.      end;
  220.    end;
  221.  
  222.    Since you will very rarely be processing more that one item at a time, you should very rarely need to
  223.    go to this trouble.
  224.  
  225.    The GoUp method works in a similar way (it invalidates previous results of GoUp or Item[].
  226.    GoUp(n) removes the last "n" items from the item id list and returns the result. The id list
  227.    being operated on is not affected, hence GoUp() calls on a given TPTIdListArray are NOT cumulative.
  228.  }
  229. type TPTIdListArray = class(TObject)
  230.        public
  231.          constructor Create( p: PItemIdList );
  232.          destructor  Destroy; override;
  233.  
  234.          function GoUp( items: Integer ): PItemIdList;
  235.  
  236.          property ItemCount: Integer read GetCount;
  237.          property Item[idx: Integer]: PItemIdList read GetItem; default;
  238.      end; {TPTIdListArray}
  239.  
  240.  
  241. type
  242.   TPTPidlList = class(TObject)
  243.   public
  244.     constructor Create;
  245.     destructor Destroy; override;
  246.  
  247.     function  Add(const PIDL: PItemIdList): Integer; virtual;
  248.     function  AddObject(const PIDL: PItemIdList; aObject: TObject): Integer; virtual;
  249.     procedure Delete(index: Integer);
  250.     procedure Clear;
  251.     function  IndexOf(const PIDL: PItemIdList) : Integer;
  252.  
  253.     procedure Insert(Index: Integer; Pidl: PItemIdList);
  254.     procedure InsertObject(Index: Integer; Pidl: PItemIdList; aObject: Pointer);
  255.  
  256.     procedure Sort;
  257.     property PIDLs[index: Integer]: PItemIdList read GetPIDL write SetPIDL; default;
  258.     property Objects[index: Integer]: Pointer read GetObject write SetObject;
  259.     property Sorted: Boolean read FSorted write SetSorted;
  260.     property Malloc: IMalloc read FMalloc write FMalloc;
  261.     property Count: Integer read GetCount;
  262.     property ShellFolder: IShellFolder read FShellFolder write FShellFolder;
  263.  
  264.     property Duplicates: TDuplicates read FDuplicates write FDuplicates;
  265.     property Capacity: Integer read GetCapacity write SetCapacity;
  266.   end;
  267.  
  268.  
  269.  
  270. {-- Shortcuts Utilities --------------}
  271. type  TLinkDataOption = (ldoUseDesc, ldoUseArgs, ldoUseIcon, ldoUseWorkDir, ldoUseHotKey, ldoUseShowCmd);
  272.       TLinkDataOptions = set of TLinkDataOption;
  273.  
  274.       TLinkData = record
  275.        // Mandatory members
  276.         pathName: String;     // Pathname of original object
  277.         options: TLinkDataOptions; // Set of flags indicating optional member usage
  278.  
  279.        // Optional members
  280.         desc: String;         // Description of link file (its filename for example)
  281.         args: String;         // Command-line arguments
  282.         iconPath: String;     // Pathname of file containing the icon
  283.         iconIndex: Integer;   // Index of icon in 'iconPath'.  -ve values are resource ids (i think?).
  284.         workingDir: String;   // Working directory when process starts
  285.         showCmd: Integer;     // How to show the initial window
  286.         hotkey: Word;         // Hot key for the link
  287.         noUI: Boolean;        // Prevent any error or search dialogs from displaying
  288.  
  289.        // Output members - used by ResolveShortcut, not used by CreateShortcut or CreateQuickShortcut
  290.         idList: PItemIdList;
  291.         w32fd: TWin32FindData;
  292.       end; {TLinkData}
  293.  
  294. function CreateShortcut( const linkPathName: String;  const linkData: TLinkData ): HResult;
  295. function CreateQuickShortcut( const linkPathName, targetPathName: String ): HResult;
  296.  
  297. function ResolveShortcut( const linkPathName: String;  var linkData: TLinkData;  afWantIdList: Boolean ): HResult;
  298.  
  299. //--
  300. function PTClsidFromFileType( aExtension: String;  var aCLSID: TGUID ): Boolean;
  301.  
  302. //--
  303. var gFlushDriveInfoSem: Integer;
  304.  
  305. {$IFNDEF VCL30PLUS}
  306. procedure OleCheck( code: DWORD );
  307. {$ENDIF}
  308.  
  309. procedure FlushDriveInfoCache;
  310. procedure LockFlushDriveInfoCache;
  311. procedure UnlockFlushDriveInfoCache;
  312.  
  313.  
  314. //-- WM_DEVICECHANGE broadcast handler
  315.  
  316. type
  317.   TPTDeviceChangeEvent = procedure(ASender: TObject;  var AMessage: TMessage) of object;
  318.  
  319.   TPTDeviceChangeHandler = class(TObject)
  320.   public
  321.     constructor Create;
  322.     destructor  Destroy; override;
  323.     procedure Add(AToNotify: TPTDeviceChangeEvent);
  324.     procedure Remove(AToNotify: TPTDeviceChangeEvent);
  325.     property Active: Boolean read FActive write FActive;
  326.   end;
  327.  
  328. function PTDeviceChangeHandler: TPTDeviceChangeHandler;
  329.  
  330. {$IFDEF INTERNAL_DEBUG}
  331. {__________________________________________________________________________________________________}
  332. const
  333.   IID_IptDebugMalloc_d2: TGUID = (D1:$6ABABE4E; D2:$641E; D3:$4B86;
  334.     D4:($AF,$D5,$3E,$79,$89,$B0,$A4,$64));
  335.  
  336. type
  337.   IptDebugMalloc_d2 = class
  338.     {-- IUnknown --}
  339.     function QueryInterface(const iid: Ole2.TIID; var obj): HResult; virtual; stdcall; abstract;
  340.     function AddRef: Longint; virtual; stdcall; abstract;
  341.     function Release: Longint; virtual; stdcall; abstract;
  342.  
  343.     {-- IMalloc --}
  344.     function Alloc(cb: Longint): Pointer; virtual; stdcall; abstract;
  345.     function Realloc(pv: Pointer; cb: Longint): Pointer; virtual; stdcall; abstract;
  346.     procedure IMalloc_Free(pv: Pointer); virtual; stdcall; abstract;
  347.     function GetSize(pv: Pointer): Longint; virtual; stdcall; abstract;
  348.     function DidAlloc(pv: Pointer): Integer; virtual; stdcall; abstract;
  349.     procedure HeapMinimize; virtual; stdcall; abstract;
  350.  
  351.     {-- IptDebugMalloc_d2 --}
  352.     procedure Acquired(p: Pointer); virtual; stdcall; abstract; {Call when you acquire a block that you must free}
  353.     procedure Released(p: Pointer); virtual; stdcall; abstract; {Call this if you hand over responsibility for a block}
  354.     function GetBlockList: TStringList; virtual; stdcall; abstract;
  355.     procedure GetStats(var AAllocCount, AFreeCount, AFreeNotInListCount: Integer); virtual; stdcall; abstract;
  356.   end;
  357.  
  358.  
  359.   TptDebugIMalloc_d2 = class(IptDebugMalloc_d2)
  360.     end;
  361.  
  362.     FWrappedInterface: Ole2.IMalloc;
  363.     FBlocks: TStringList;
  364.  
  365.     procedure AddBlock(p: Pointer);
  366.     procedure RemoveBlock(p: Pointer);
  367.     function PointerToKey(p: Pointer): String;
  368.  
  369.   public
  370.     constructor Create(AWrappedInterface: Ole2.IMalloc);
  371.     destructor Destroy; override;
  372.  
  373.     {-- IUnknown --}
  374.     function QueryInterface(const iid: Ole2.TIID; var obj): HResult; override;
  375.     function AddRef: Longint; override;
  376.     function Release: Longint; override;
  377.  
  378.     {-- IMalloc --}
  379.     function Alloc(cb: Longint): Pointer; override;
  380.     function Realloc(pv: Pointer; cb: Longint): Pointer; override;
  381.     procedure IMalloc_Free(pv: Pointer); override;
  382.     function GetSize(pv: Pointer): Longint; override;
  383.     function DidAlloc(pv: Pointer): Integer; override;
  384.     procedure HeapMinimize; override;
  385.  
  386.     {-- IptDebugMalloc_d2 --}
  387.     procedure Acquired(p: Pointer); override;
  388.     procedure Released(p: Pointer); override;
  389.     function GetBlockList: TStringList; override;
  390.     procedure GetStats(var AAllocCount, AFreeCount, AFreeNotInListCount: Integer); override;
  391.   end;
  392.  
  393. function GetPtDebugIMalloc(AMalloc: IMalloc): IMalloc;
  394.  
  395. function GetIMallocAsIptDebugMalloc_d2(AMalloc: IMalloc): IptDebugMalloc_d2;
  396. {$ENDIF}
  397.  
  398.  
  399. {__________________________________________________________________________________________________}
  400. // You can pass these 'verbs' to TPTShellList.DoCommandForAllSelected and TPTShellTree.DoCommandForNode
  401. // to execute the relevant menu command. These strings are never displayed and are language independent.
  402.  
  403. // -- These commands are available to most folders --
  404. const PTSH_CMDS_DELETE = 'delete';
  405.       PTSH_CMDS_PASTE  = 'paste';
  406.       PTSH_CMDS_CUT    = 'cut';
  407.       PTSH_CMDS_COPY   = 'copy';
  408.       PTSH_CMDS_PROPERTIES = 'properties';
  409.       PTSH_CMDS_EXPLORE = 'explore';  // Opens a Windows explorer
  410.       PTSH_CMDS_OPEN   = 'open';      // Opens a Windows explorer folder-view
  411.       PTSH_CMDS_FIND   = 'find';      // Open the find dialog
  412.       PTSH_CMDS_LINK   = 'link';      // Same as 'Create Shortcut' menu item
  413.  
  414. // -- Commands used by Dialup Networking
  415. const PTSH_CMDS_DUN_CREATE = 'create';    // Create new connection wizard
  416.       PTSH_CMDS_DUN_CONNECT = 'connect';  // Connect
  417.  
  418. // -- These are commands that have no 'verb' but have tested to have the same ID under Win95, Win95OSR2, WinNT4 and IE4
  419. // -- So the id is pretty reliable, but there a no promises!
  420. // -- The other thing to remember is that the IDs are reused for different types of folders. So make sure you use the
  421. // -- right command ID with the right kind of folder.
  422. const PTSH_CMDID_FORMAT = PChar(35);    // Only on drive root directory folders
  423.                                         // Doesn't seem to work
  424.  
  425. { Substitutes strings of the form %1,%2 etc. into aFmtStr and returns the result. }
  426. function FormatStrPos( aFmtStr: String;  data: array of String ): String;
  427.  
  428. { Given a command line string 'ins' returns all the parameters, taking into account
  429.   quotes and double-byte characters. }
  430. procedure ParametizeCmdLineDB( const ins: String;  outs: TStrings );
  431.  
  432. {DBCS enabled TrimRight}
  433. function TrimRightDB(Str: String): String;
  434.  
  435. {Copies possible DB char at 'aPos' from 'aSource' and appends to 'aDest', incrementing 'aPos' by 1 or 2.}
  436. procedure CopyCharDB(var APos: Integer;  const ASource: String;  var ADest: String);
  437.  
  438.  
  439. // __ WM_DEVICECHANGE constants ___________________________
  440. const
  441.   DBT_DEVNODES_CHANGED        = $0007;
  442.   DBT_QUERYCHANGECONFIG       = $0017;
  443.   DBT_CONFIGCHANGED           = $0018;
  444.   DBT_CONFIGCHANGECANCELED    = $0019;
  445.   DBT_MONITORCHANGE           = $001B;
  446.   DBT_SHELLLOGGEDON           = $0020;
  447.   DBT_CONFIGMGAPI32           = $0022;
  448.   DBT_VXDINITCOMPLETE         = $0023;
  449.   DBT_VOLLOCKQUERYLOCK        = $8041;
  450.   DBT_VOLLOCKLOCKTAKEN        = $8042;
  451.   DBT_VOLLOCKLOCKFAILED       = $8043;
  452.   DBT_VOLLOCKQUERYUNLOCK      = $8044;
  453.   DBT_VOLLOCKLOCKRELEASED     = $8045;
  454.   DBT_VOLLOCKUNLOCKFAILED     = $8046;
  455.   DBT_NO_DISK_SPACE           = $0047;
  456.   DBT_LOW_DISK_SPACE          = $0048;
  457.   DBT_DEVICEARRIVAL           = $8000;  // system detected a new device
  458.   DBT_DEVICEQUERYREMOVE       = $8001;  // wants to remove, may fail
  459.   DBT_DEVICEQUERYREMOVEFAILED = $8002;  // removal aborted
  460.   DBT_DEVICEREMOVEPENDING     = $8003;  // about to remove, still avail.
  461.   DBT_DEVICEREMOVECOMPLETE    = $8004;  // device is gone
  462.   DBT_DEVICETYPESPECIFIC      = $8005;  // type specific event
  463.   DBT_DEVTYP_OEM              = $00000000;  // oem-defined device type
  464.   DBT_DEVTYP_DEVNODE          = $00000001;  // devnode number
  465.   DBT_DEVTYP_VOLUME           = $00000002;  // logical volume
  466.   DBT_DEVTYP_PORT             = $00000003;  // serial, parallel
  467.   DBT_DEVTYP_NET              = $00000004;  // network resource
  468.   DBT_DEVTYP_DEVICEINTERFACE  = $00000005;  // device interface class
  469.   DBT_DEVTYP_HANDLE           = $00000006;  // file system handle
  470.  
  471.  
  472. {*********************************************************}
  473. implementation
  474.